package edu.wtbu.dao;

import java.io.IOException;
import java.io.InputStream;

import java.util.List;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;


import edu.wtbu.pojo.Users;

public class UsersDao {
	public static List<Users> findByEmailAndPassword(Users users) {
	List<Users> list=null;
	
	String resource="mybatis-config.xml";
	try {
		System.out.println(resource);
	InputStream inputStream = Resources.getResourceAsStream(resource);
	
	SqlSessionFactory sessionFactory=new SqlSessionFactoryBuilder().build(inputStream);
	System.out.println(sessionFactory);
	
	SqlSession session =sessionFactory.openSession();
	String Statement="edu.wtbu.dao.UsersDao.findByEmailAndPassword";
	list=session.selectList(Statement, users);
	}
	catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return list;
	}
}
